package com.joesem.sale.client.widget.dialog

import android.view.LayoutInflater
import android.view.View
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.jiaxing.sale.client.databinding.DialogWorkOrderTypeBinding
import com.joesem.sale.client.utils.click

fun workOrderTypePopup(view: View, selectedType: (String) -> Unit) {
    BottomSheetDialog(view.context).apply {
        val bind = DialogWorkOrderTypeBinding.inflate(LayoutInflater.from(view.context))
        bind.btnRepair.click {
            selectedType.invoke("维保工单")
            dismiss()
        }
        bind.btnInstall.click {
            selectedType.invoke("安装工单")
            dismiss()
        }
        bind.btnTraining.click {
            selectedType.invoke("培训工单")
            dismiss()
        }
        bind.btnDebug.click {
            selectedType.invoke("调试工单")
            dismiss()
        }
        setContentView(bind.root)
    }.show()
}